package com.lb.shopguide.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lb.shopguide.R;
import com.lb.shopguide.entity.order.GoodsInOrderBean;
import com.lb.shopguide.util.pic.ImageLoaderUtils;

import java.util.List;

/**
 * Created by kang on 2017/6/3.
 */

public class AdapterGoodsInOrderCommon extends BaseQuickAdapter<GoodsInOrderBean, BaseViewHolder> {
    public AdapterGoodsInOrderCommon(int layoutResId, List<GoodsInOrderBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GoodsInOrderBean item) {
        View view = helper.itemView;
        TextView tvProductName = view.findViewById(R.id.tv_product_name);
        TextView tvSize = view.findViewById(R.id.tv_size);
        TextView tvPrice = view.findViewById(R.id.tv_price);
        TextView tvSum = view.findViewById(R.id.tv_sum);
        ImageView ivProductPic = view.findViewById(R.id.iv_product);
        RelativeLayout layoutSizeAndSum = view.findViewById(R.id.layout_size_and_sum);

        // TODO: 2017/11/1  区分快速收银订单和正常订单
        ImageLoaderUtils.displayRound(mContext, ivProductPic, item.getProductPicUrl(), 4);
        tvSize.setText(String.format(mContext.getResources().getString(R.string.format_string_size), item.getColor(), item.getSize()));
        tvProductName.setText(item.getProductName());
        tvPrice.setText("￥" + item.getPrice());
        tvSum.setText("x" + item.getProductSum());
    }
}
